//
//  ChangeButton.m
//  PeaPodAgent
//
//  Created by MasterLing on 2018/4/10.
//  Copyright © 2018年 MasterLing. All rights reserved.
//

#import "ChangeButton.h"

#define lineWidth 1.5

@implementation ChangeButton

- (void)drawRect:(CGRect)rect {
    // Drawing code
    
    CGFloat width = rect.size.width;
    CGFloat height = rect.size.height;
    //获取上下文 上下文的输出目标就是self[view]
    CGContextRef context = UIGraphicsGetCurrentContext();
    // 设置线颜色
    CGContextSetRGBStrokeColor(context, 90/255.0, 204/255.0, 255/255.0, 1);
    // 设置线宽
    CGContextSetLineWidth(context, lineWidth);
    //设置一起点
    CGContextMoveToPoint(context, 0, lineWidth);
    CGContextAddLineToPoint(context, width - height/2, lineWidth);
    CGContextAddArc(context, width - height/2 -lineWidth, height/2, height/2-lineWidth, M_PI_2*3, M_PI_2, 0);
    CGContextAddLineToPoint(context, 0, height-lineWidth);
    //只是画一条，【空心】
    CGContextStrokePath(context);
}

@end
